home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / msysjour / vol04 / 01a / genapp2 / winmain.c < prev    next >
C/C++ Source or Header  |  1988-10-24  |  17KB  |  612 lines

  1. /****************************************************************************
  2.         WINMAIN.C
  3. **********************************************************************«*****/
  4.  
  5. #ifdef AS
  6. #include    <memory.h>
  7. #endif
  8.  
  9. #include    "config.h"
  10.  
  11. #define NOPOLYGON
  12. #define NOMINMAX
  13. #define NOSOUND
  14. #define NOCOMM
  15. #define NOKANJI
  16.  
  17. #include    "windows.h"
  18. #include    "wgenapp.h"
  19.  
  20. #include    "stddefs.h"
  21.  
  22. #include     "applcatn.h"
  23. #include    "envrnmt.h"
  24.  
  25. /****************************************************************/
  26.  
  27. PUBLIC int  PASCAL    WinMain(HANDLE, HANDLE, LPSTR, int);
  28.  
  29. PUBLIC LONG WCALLBACK    win_ChildWndProc(HWND,int,WORD,LONG);
  30. PUBLIC LONG WCALLBACK    win_MainWndProc(HWND,int,WORD,LONG);
  31.  
  32. PUBLIC BOOL WCALLBACK    dlg_AboutBoxProc(HWND,unsigned,WORD,LONG);
  33. PUBLIC VOID        win_UpdateAppWndSize(Rect *);
  34.  
  35. /****************************************************************/
  36.  
  37. PUBLIC    VOID        win_ScreenToAppl        (POINT *);
  38.  
  39. LOCAL    BOOL        win_FirstTimeInitialization    (HANDLE);
  40. LOCAL    BOOL        win_EveryTimeInitialization    (HANDLE);
  41. LOCAL    VOID        win_DoCommandMsg        (HANDLE,WORD);
  42.  
  43. LOCAL    VOID        win_MakeCmdEvent        (HWND,int,int);
  44. LOCAL    VOID        win_MakeCharEvent        (HWND,int);
  45. LOCAL    VOID        win_MakeMouseEvent        (HWND,int,int,int);
  46. LOCAL    VOID        win_MakeAppEvent        (HWND,int);
  47.  
  48.  
  49. /****************************************************************/
  50.  
  51. LOCAL    HANDLE        hAppInstance;
  52. LOCAL    HWND        hAppWnd;
  53.  
  54. LOCAL    HCURSOR        hArrowCursor;
  55. LOCAL    HCURSOR        hIBeamCursor;     
  56. LOCAL    HCURSOR        hWaitCursor;      
  57.  
  58. LOCAL    BOOL        bIsFirstTime = TRUE;
  59. LOCAL    BOOL        bIsMouseDown = FALSE;
  60. LOCAL    BOOL        bIsAppEvent = FALSE;
  61.  
  62. LOCAL    RECT        appWndRect;    /* in CLIENT coords */
  63. LOCAL    RECT        appScrRect;    /* in SCREEN coords */
  64.  
  65. /****************************************************************
  66.     QUERY FUNCTIONS provide private data to other modules
  67. ****************************************************************/
  68.  
  69. PUBLIC HANDLE win_GethAppInstance() { return hAppInstance; }
  70. PUBLIC HWND   win_GethAppWnd     () { return hAppWnd     ; }
  71. PUBLIC VOID   win_GetAppWndRect(r) RECT *r; { *r = appWndRect; }
  72.  
  73. /****************************************************************
  74.     EVENT PROCESSING build application-level event structure
  75. *****************************************************************/
  76.  
  77. LOCAL APPEVENT * theAppEvent;
  78.  
  79. PUBLIC VOID win_GetAppEvent(the_event) /*called from application*/
  80.     APPEVENT *        the_event;
  81. {
  82.     MSG            msg;
  83.  
  84.     bIsAppEvent = FALSE;
  85.     theAppEvent = the_event;/* store ptr so MakeAppEvent can find it*/
  86.  
  87.     /* this is the internal event loop, which runs until an
  88.      * event of interest to the application-level is encountered.
  89.      */
  90.     while (GetMessage((LPMSG) &msg, NULL, 0, 0) && !bIsAppEvent)
  91.     {
  92.         TranslateMessage((LPMSG) &msg);
  93.         DispatchMessage((LPMSG)  &msg);
  94.     }
  95.     ut_PrintShort("RV|winGetAppEvent: returns type#",the_event->event_type);
  96. }
  97.  
  98. /****************************************************************
  99.     These little functions build different types of app events.
  100.     (Could have been done with in-line code. I placed them here
  101.     for consistency.)
  102. *****************************************************************/
  103.  
  104. LOCAL VOID win_MakeCmdEvent(hWnd,category,item)
  105.     HWND    hWnd;
  106.     int        category,item;
  107. {
  108.     theAppEvent->event_type    = CMD_EVENT;
  109.     theAppEvent->cmd_category    = category;
  110.     theAppEvent->cmd_item    = item;
  111.     theAppEvent->canvas        = GetWindowWord(hWnd,0);
  112.     bIsAppEvent = TRUE;
  113. }
  114.  
  115. LOCAL VOID win_MakeCharEvent(hWnd,the_char)
  116.     HWND    hWnd;
  117.     int        the_char;
  118. {
  119.     theAppEvent->event_type    = CHAR_EVENT;
  120.     theAppEvent->the_char    = the_char;
  121.     theAppEvent->canvas        = GetWindowWord(hWnd,0);
  122.     bIsAppEvent = TRUE;
  123. }
  124.  
  125. LOCAL VOID win_MakeMouseEvent(hWnd,type,x,y)
  126.     HWND    hWnd;
  127.     int        type,x,y;
  128. {
  129.     theAppEvent->event_type    = type;
  130.     theAppEvent->where.h    = x;
  131.     theAppEvent->where.v    = y;    
  132.     theAppEvent->canvas        = GetWindowWord(hWnd,0);
  133.     bIsAppEvent = TRUE;
  134. }
  135.  
  136. LOCAL VOID win_MakeAppEvent(hWnd,type)
  137.     HWND    hWnd;
  138.     int        type;
  139. {
  140.     ut_PrintShort("RV|MakeAppEvent: type#",type);
  141.     theAppEvent->event_type    = type;
  142.     theAppEvent->canvas        = GetWindowWord(hWnd,0);
  143.     bIsAppEvent = TRUE;
  144. }
  145.  
  146. /****************************************************************
  147.     Handle windows command events. Translate to application level.
  148. *****************************************************************/
  149. LOCAL VOID win_DoCommandMsg(hWnd, cmd)
  150.     HWND hWnd;    
  151.     WORD cmd;
  152. {
  153. #define DEBUG_MENU 9000
  154.  
  155.     ut_PrintShort("RV|win_DoCommandMsg: cmd",cmd);
  156. #ifdef DBG
  157.     if(ut_DebugMenuFilter(cmd - DEBUG_MENU))    return;    
  158. #endif
  159.     win_MakeCmdEvent(hWnd, (cmd/100)*100 , cmd%100);
  160.     return;
  161. }
  162.  
  163.  
  164.  
  165. /******************************************************************
  166.     ABOUT BOX DIALOG HANDLER
  167. *******************************************************************/    
  168.  
  169. #define SIZEOF_ABOUTSTR 10
  170. LOCAL CHAR     AboutString[SIZEOF_ABOUTSTR];/* about str in sys menu */
  171. LOCAL FARPROC    lpprocAbout;
  172. LOCAL WORD    AboutDlgFlag;
  173.  
  174. /****************************************************************/
  175. PUBLIC BOOL WCALLBACK dlg_AboutBoxProc( hDlg, message, wParam, lParam )
  176.     HWND        hDlg;
  177.     unsigned        message;
  178.     WORD        wParam;
  179.     LONG        lParam;
  180. {
  181.     if (message == WM_COMMAND) 
  182.     {
  183.     EndDialog( hDlg, AboutDlgFlag );
  184.     return TRUE;
  185.     }
  186.     else if (message == WM_INITDIALOG)
  187.     return TRUE;
  188.     else return FALSE;
  189. }
  190.  
  191. /****************************************************************/
  192. LOCAL BOOL dlg_InitAboutBox(hInstance,hAppWnd)
  193.  
  194.     HANDLE    hInstance;
  195.     HWND    hAppWnd;
  196. {
  197.     HMENU    hMenu;
  198.     lpprocAbout = MakeProcInstance( (FARPROC)dlg_AboutBoxProc, hInstance );
  199.  
  200.     LoadString(hInstance,            /* handle to the instance */
  201.            IDS_ABOUT,          /* unsigned short defined in design.h */
  202.            (LPSTR)AboutString, /* lp to buffer where string is loaded */
  203.            SIZEOF_ABOUTSTR);  /* max no. of chars to go into the buffer */
  204.  
  205.     hMenu = GetSystemMenu(hAppWnd,FALSE); /* get handle to the system menu */
  206.     if(hMenu==NULL) return FALSE;
  207.     ChangeMenu(hMenu, 0, NULL, 999, MF_APPEND | MF_SEPARATOR);
  208.     ChangeMenu(hMenu, 0, (LPSTR)AboutString, ABOUT_SELECT, 
  209.                 MF_APPEND | MF_STRING);
  210.     return TRUE;
  211. }
  212.  
  213.  
  214. /****************************************************************
  215.     WINMAIN
  216. *****************************************************************/
  217.  
  218. PUBLIC int PASCAL WinMain(hThisInstance, hPrevInstance, lpszCmdLine, cmdShow)
  219.  
  220.     HANDLE    hThisInstance;
  221.     HANDLE    hPrevInstance;
  222.     LPSTR    lpszCmdLine;
  223.     int        cmdShow;
  224. {
  225. #define EXTRA_BYTES    sizeof(int)    /*extrabytes in window class */
  226.  
  227.     /* If there is no previous instance of this app, do initialization */
  228.     if (!hPrevInstance)
  229.     {
  230.     if (!win_FirstTimeInitialization(hThisInstance))    return FALSE;
  231.     }
  232.     else
  233.     {
  234.     /* Initialization for subsequent instances only */
  235.     /* Copy data from previous instance */
  236.     GetInstanceData( hPrevInstance, AboutString, SIZEOF_ABOUTSTR);
  237.     }
  238.  
  239.     if(!win_EveryTimeInitialization(hThisInstance))        return FALSE;
  240.     /* above has set up hAppWnd */
  241.     ShowWindow(  hAppWnd, cmdShow);
  242.     app_MainProcedure();
  243.     exit(0);
  244. }
  245.  
  246. /****************************************************************/
  247.  
  248. PUBLIC BOOL within_exit_sequence = FALSE; /*for displaying debug msgs*/
  249.     
  250.  
  251. PUBLIC LONG WCALLBACK win_MainWndProc(hWnd, message, wParam, lParam) 
  252.  
  253.     HWND    hWnd;
  254.     int        message;
  255.     WORD    wParam;
  256.     LONG    lParam;
  257. {
  258.     if (message != WM_NCHITTEST     /*don't trace these frequent msgs*/
  259.     && message != WM_MOUSEMOVE
  260.     && message != WM_NCMOUSEMOVE 
  261.     && message != WM_DESTROY 
  262.     && message != WM_NCDESTROY
  263.     && !within_exit_sequence)
  264.     {
  265.     ut_Print2Hex("RV|MainWndProc: hAppWnd hAppInstance",
  266.             (long)hAppWnd,(long)hAppInstance);
  267.     ut_Print4Hex("RV|MainWndProc: hWnd message w l",
  268.             (long)hWnd,(long)message,(long)wParam,(long)lParam);
  269.     }
  270.  
  271.     hAppWnd = hWnd;
  272.  
  273.     switch (message)
  274.     {
  275.     case WM_SYSCOMMAND:
  276.         {
  277.            switch (wParam & 0xfff0)
  278.            {
  279.            case ABOUT_SELECT:
  280.          AboutDlgFlag = DialogBox(GetWindowWord(hWnd, GWW_HINSTANCE),
  281.                      MAKEINTRESOURCE(IDD_ABOUT_BOX),
  282.                      hWnd,lpprocAbout);
  283.          break;
  284.  
  285.            default:   return DefWindowProc(hWnd, message, wParam, lParam);
  286.            } 
  287.         } break;
  288.  
  289.     case WM_CREATE:   
  290.     {
  291.         if (bIsFirstTime == TRUE)
  292.         {
  293.         win_UpdateAppWndSize((Rect *)NULL);
  294.         
  295. #ifdef DBG
  296.         if(!ut_CreateDBugWindow(hWnd, 0)) FatalExit(0x111);
  297.             /*FatalError("ML|MainWndProc: CreateDBG failed!");*/
  298. #endif
  299.         bIsFirstTime = FALSE;
  300.  
  301.         }
  302.         ut_PutLine("RV|MainWndProc: WM_CREATE");
  303.     } break;
  304.         
  305.  
  306.     case WM_CHAR:
  307.         {
  308.         ut_Print2Hex("RV|MainWndProc: WM_CHAR w l",
  309.                 (long)wParam,(long)lParam);
  310.         win_MakeCharEvent(hWnd, wParam);
  311.         }  break;    
  312.  
  313.     case WM_DESTROY:
  314.     {
  315.         within_exit_sequence = TRUE;
  316.         PostQuitMessage(0);        
  317.         win_MakeAppEvent(hWnd, QUIT_EVENT);        
  318.     } break;
  319.  
  320.     case WM_COMMAND: /* check if its not a menu selection */
  321.     {
  322.         ut_Print2Hex("RV|MainWndProc: WM_COMMAND: w l",
  323.         (long)wParam,(long)lParam);
  324.         if (lParam != 0)  
  325.         return DefWindowProc(hWnd, message, wParam, lParam);
  326.         /*else*/
  327.         win_DoCommandMsg(hWnd, wParam);
  328.     } break;
  329.  
  330.     case WM_SIZE:
  331.     case WM_MOVE:
  332.     {
  333.         win_UpdateAppWndSize((Rect *)NULL);
  334.     } break;
  335.  
  336.     case WM_PAINT:
  337.     {
  338.         PAINTSTRUCT        ps;
  339.         HDC            hDC;
  340.         
  341.         BeginPaint(hWnd, (LPPAINTSTRUCT) & ps);
  342. #if 0 /*for testing*/
  343.         hDC = ps.hdc;
  344.         TextOut(hDC,40,20,"WITHIN THE PAINT MSG",
  345.         strlen("WITHIN THE PAINT MSG"));
  346.         ut_PutLine("RV|MainWndProc: WM_PAINT");
  347.         /*ValidateRect(hWnd,(LPRECT)NULL);<<<necessary?<<<*/
  348. #endif
  349.         EndPaint(hWnd, (LPPAINTSTRUCT) & ps);
  350.     }
  351.     break;
  352.  
  353.     case WM_LBUTTONDOWN:
  354.     {
  355.         int x = LOWORD(lParam);
  356.         int y = HIWORD(lParam);
  357.  
  358.         ut_Print2Shorts("RV|MainWndProc: LBUTTONDOWN",x,y);
  359.     } break;
  360.  
  361.     default:
  362.         /* Anything else is thrown away. */
  363.     return DefWindowProc(hWnd, message, wParam, lParam);
  364.     }
  365.     return (long)FALSE;
  366. }
  367.  
  368. /****************************************************************/
  369.  
  370. PUBLIC LONG WCALLBACK win_ChildWndProc(hWnd, message, wParam, lParam)
  371.  
  372.     HWND        hWnd;
  373.     int            message;
  374.     WORD        wParam;
  375.     long        lParam;
  376. {
  377.     extern BOOL window_is_being_created;
  378.     extern long env_GetCanvasDev();
  379.     static int prev_canvas = -1;
  380.     POINT        pt;
  381.     int            canvas;
  382.     
  383.     canvas = GetWindowWord(hWnd,0); /* get extra bytes in ms-window struc */
  384.  
  385.     if (message != WM_NCHITTEST /*0x84*/ 
  386.     && message != WM_MOUSEMOVE /*0x200*/
  387.     && message != WM_NCMOUSEMOVE /*0xa0*/)
  388.     {
  389.     ut_Print2Hex("RV|ChildWndProc: hAppInst hAppWnd",
  390.             (long)hAppInstance,(long)hAppWnd);
  391.     ut_Print4Hex("RV|ChildWndProc: message w l hWnd",
  392.             (long)message,(long)wParam,(long)lParam,(long)hWnd);
  393.     ut_PrintShort("RV|ChildWndProc: canvas#",canvas);
  394.     }
  395.  
  396.     if( window_is_being_created)
  397.         return DefWindowProc(hWnd, message, wParam, lParam);
  398.  
  399.     pt = MAKEPOINT(lParam);
  400.     ClientToScreen(hWnd, (LPPOINT) &pt);
  401.     win_ScreenToAppl(&pt); /* point is now in "mac global" coordinates */
  402.  
  403.             
  404.     switch (message)    /* we can now switch on message type */
  405.     {
  406.     case WM_LBUTTONDOWN:
  407.     {
  408.         bIsMouseDown = TRUE;
  409.  
  410.         ut_Print2Shorts("RV|ChildWndProc: PAGE mse DOWN",
  411.             (short) LOWORD(lParam), (short) HIWORD(lParam));
  412.  
  413.         ut_Print2Shorts("RV|ChildWndProc: canvas, prev_canvas",
  414.                 canvas,prev_canvas);
  415.  
  416.         if (canvas != prev_canvas)    /* they have to click on it */
  417.         {
  418.         ut_PrintShort("RV|ChildWndProc: ActivateVIEW canvas#",canvas);
  419.         prev_canvas = canvas;
  420.         /*return DefWindowProc(hWnd, message, wParam, lParam);*/
  421.         win_MakeAppEvent(hWnd,ACTIVATEVIEW_EVENT);
  422.         }
  423.         else
  424.         {
  425.         /*SetCapture(hWnd);*/
  426.         win_MakeMouseEvent(hWnd, MOUSEDOWN_EVENT,pt.x,pt.y);
  427.         }
  428.         return (long)TRUE;
  429.     }   break;
  430.  
  431.     case WM_SIZE:
  432.     {
  433.         win_MakeAppEvent(hWnd, RESIZEVIEW_EVENT);
  434.     }   break;
  435.  
  436.  
  437.     case WM_LBUTTONUP:
  438.     {
  439.         bIsMouseDown = FALSE;
  440.         /*ReleaseCapture();*/
  441.         win_MakeMouseEvent(hWnd, MOUSEUP_EVENT,pt.x,pt.y);
  442.         return (long)TRUE;
  443.     }   break;
  444.  
  445.     case WM_PAINT:
  446.     {
  447.         ut_PrintShort("RV|ChildWndProc: WM_PAINT on canvas#",canvas);
  448.         win_MakeAppEvent(hWnd, UPDATEVIEW_EVENT);
  449.         return (long)TRUE;
  450.     }   break;
  451. #if 0 /*---- other cases to handle in the future---*/
  452.     case WM_CHAR:    /* Key Hit */
  453.     {
  454.         win_MakeCharEvent(hWnd, wParam);
  455.     } break;
  456.     
  457.     case WM_CLOSE:
  458.     {
  459.         win_MakeAppEvent(hWnd, CLOSEVIEW_EVENT);
  460.         ShowWindow(hWnd, HIDE_WINDOW);
  461.         return (long)TRUE;
  462.     } break;
  463.  
  464.     case WM_SIZE:
  465.     {
  466.         win_UpdatePageWindowSize(argument needed)
  467.         win_MakeAppEvent(hWnd, RESIZEVIEW_EVENT);
  468.     }   break;
  469.  
  470.     case WM_MOUSEMOVE:
  471.     {
  472.         win_MakeMouseEvent(hWnd, NULL_EVENT,pt.x,pt.y);
  473.     }   break;
  474. #endif
  475.     }
  476.     return DefWindowProc(hWnd, message, wParam, lParam);
  477. }
  478.  
  479.  
  480. /****************************************************************/
  481. LOCAL BOOL  win_FirstTimeInitialization(hInstance)
  482.     HANDLE hInstance;
  483. {
  484.     /* register the three types of windows: main, page and debug */
  485.     WNDCLASS wcMainWindow, wcChildWindow;
  486.  
  487.     memset(&wcMainWindow,0,sizeof(WNDCLASS));
  488.     memset(&wcChildWindow,0,sizeof(WNDCLASS));    
  489.     
  490.     wcMainWindow.hCursor    = (HANDLE) NULL;
  491.     wcMainWindow.hCursor    = LoadCursor(NULL, 
  492.                     MAKEINTRESOURCE(IDC_ARROW));
  493.     wcMainWindow.hIcon        = LoadIcon(hInstance, (LPSTR) "GENAPP");
  494.     wcMainWindow.lpszMenuName    = (LPSTR) "GENAPP";
  495.     wcMainWindow.lpszClassName    = (LPSTR) "GENAPP";
  496.     wcMainWindow.hbrBackground    = GetStockObject(WHITE_BRUSH);
  497.     wcMainWindow.hInstance    = hInstance;
  498.     wcMainWindow.style        = CS_VREDRAW | CS_HREDRAW;
  499.     wcMainWindow.lpfnWndProc    = win_MainWndProc;
  500.     wcMainWindow.cbWndExtra    = EXTRA_BYTES;
  501.  
  502.     if (!RegisterClass((LPWNDCLASS) &wcMainWindow))    return FALSE;
  503.  
  504.     wcChildWindow.hCursor    = (HANDLE) NULL;
  505.     wcChildWindow.hIcon        = (HANDLE) NULL;
  506.     wcChildWindow.lpszMenuName    = (LPSTR) NULL;
  507.     wcChildWindow.lpszClassName    = (LPSTR) "Child";
  508.     wcChildWindow.hbrBackground    = GetStockObject(WHITE_BRUSH);
  509.     wcChildWindow.hInstance    = hInstance;
  510.     wcChildWindow.style        = CS_VREDRAW | CS_HREDRAW 
  511.                     | CS_DBLCLKS;
  512.     wcChildWindow.lpfnWndProc    = win_ChildWndProc;
  513.     wcChildWindow.cbWndExtra    = EXTRA_BYTES;
  514.  
  515.     if (!RegisterClass((LPWNDCLASS) &wcChildWindow))    return FALSE;
  516.  
  517. #ifdef DBG
  518.     if(!ut_RegisterDBugWindow(hInstance,EXTRA_BYTES))    return FALSE;
  519. #endif
  520.     /* else */
  521.     return TRUE;
  522. }
  523.  
  524. /****************************************************************/
  525. LOCAL BOOL win_EveryTimeInitialization(hInstance)
  526.     HANDLE hInstance;
  527. {
  528.     hAppInstance = hInstance;
  529.  
  530.     hAppWnd = CreateWindow(
  531.         (LPSTR) "GENAPP",    /* The class name   */
  532.         (LPSTR) "GENAPP",    /* The window instance name */
  533.         WS_TILEDWINDOW | WS_CLIPCHILDREN,/* Window type = tiled. */
  534. #ifdef AS
  535.         CW_USEDEFAULT,0,CW_USEDEFAULT,0,
  536. #else
  537.         0, 0, 0, 0,    /* These dont apply for tiled windows. */
  538. #endif            
  539.         (HANDLE) NULL,    /* NULL for tiled. */
  540.         (HANDLE) NULL,    /* NULL means use the class menu. */
  541.         (HANDLE) hAppInstance,    /* Instance handle passedto WinMain */
  542.         NULL    /* Param passed thru WM_CREATE message, not needed. */
  543.     );
  544.  
  545.     if (hAppWnd == NULL) return FALSE;
  546.  
  547.     SetWindowWord(hAppWnd, 0, (WORD) -1);
  548.  
  549.     /* bring in cursors */
  550.     hArrowCursor      = LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW));
  551.     hIBeamCursor      = LoadCursor(NULL,MAKEINTRESOURCE(IDC_IBEAM));
  552.     hWaitCursor       = LoadCursor(NULL,MAKEINTRESOURCE(IDC_WAIT));
  553.  
  554.     if(!dlg_InitAboutBox(hAppInstance,hAppWnd)) return FALSE;
  555.     return TRUE;
  556. }
  557.  
  558.  
  559. /***************************************************************
  560.         SCREEN TO APPLICATION COORDINATE MAPPING
  561.  ***************************************************************/        
  562.  
  563. /****************************************************************/
  564. PUBLIC VOID win_ScreenToAppl(pt)
  565.     POINT *pt;
  566. {
  567.     pt->y -= appScrRect.top;
  568.     pt->x -= appScrRect.left;
  569. }
  570.  
  571. /****************************************************************/
  572. PUBLIC VOID        win_UpdateAppWndSize(mac_rect)
  573.     Rect *        mac_rect;
  574. {
  575.     POINT        p1,p2;
  576.     
  577.     GetClientRect(hAppWnd, (LPRECT) & appWndRect);
  578.  
  579.     p1.x = appWndRect.left;    p1.y = appWndRect.top;
  580.     p2.x = appWndRect.right;    p2.y = appWndRect.bottom;
  581.  
  582.     ClientToScreen(hAppWnd, (LPPOINT) &p1);
  583.     ClientToScreen(hAppWnd, (LPPOINT) &p2);    
  584.  
  585.     appScrRect.left  = p1.x;    appScrRect.top    = p1.y;
  586.     appScrRect.right = p2.x;    appScrRect.bottom = p2.y;
  587.     
  588.     ut_Print4Shorts("RV|win_UpdateAppWndSz: SCR rect", 
  589.         appScrRect.left,  appScrRect.top,
  590.         appScrRect.right, appScrRect.bottom);
  591.  
  592.     ut_Print4Shorts("RV|win_UpdateAppWndSz: WND rect", 
  593.         appWndRect.left,  appWndRect.top,
  594.         appWndRect.right, appWndRect.bottom);    
  595.  
  596.     if(mac_rect != (Rect *)NULL)
  597.     {
  598.     mac_rect->left   = appWndRect.left;
  599.     mac_rect->top    = appWndRect.top;
  600.     mac_rect->right  = appWndRect.right;
  601.     mac_rect->bottom = appWndRect.bottom;
  602.     }
  603. }
  604.  
  605. #ifndef DBG
  606. PUBLIC VOID env_FatalError(){FatalExit(0x111);}
  607. PUBLIC VOID env_NotImplemented() {;}
  608. #endif
  609.  
  610.  
  611.  
  612.